from base.Base import *
from selenium.webdriver.common.by import By

class Page(Base):
    # 百度搜索按钮loc
    baidu_but_loc=(By.ID,'chat-submit-button')
    # 断言是否正确打开百度
    def dy1(self):
        return self.get_text(self.baidu_but_loc)
    # 搜索框loc
    sousuo_loc=(By.XPATH,'/html/body/div[1]/div[1]/div[6]/div/div/div[2]/div/div/div[1]/div/div[1]/div[4]/div[1]/div[2]/textarea')
    # 搜索框输入
    def sousuo_input(self):
        self.send_keys(self.sousuo_loc,'我喜欢软件测试')
    # 点击搜索按钮
    def sousuo_but(self):
        self.click(self.baidu_but_loc)
    # 断言是否返回搜素结果
    yq2=(By.XPATH,'//*[@id="s_tab_inner"]/b')
    def dy2(self):
        return self.get_text(self.yq2)
    # 断言第一页是否包含搜索关键字
    yq3 = (By.CSS_SELECTOR,r'#\31  > div > div > div > div.title-wrapper_6E6PV > div > h3 > a > div > div > p > span > span > span > em')
    def dy3(self):
        return self.get_text(self.yq3)
    # 页码2的定位
    ye_two=(By.CSS_SELECTOR,'#page > div > a:nth-child(3) > span')
    def goto_two(self):
        self.click(self.ye_two)
    yq4=(By.CSS_SELECTOR,r'#\31 1 > div > div > div > div.title-wrapper_6E6PV')
    # 断言第二页是否包含搜索关键字
    def dy4(self):
        return self.get_text(self.yq4)
